home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / SpaceManBLaser.as < prev   
Encoding:
Text File  |  2011-10-17  |  1.4 KB  |  58 lines

  1. class classes.shots.SpaceManBLaser
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var frame;
  8.    var clip;
  9.    var xMov = 0;
  10.    var yMov = 0;
  11.    var Name = "spaceManBLaser";
  12.    var power = 30;
  13.    var yank = false;
  14.    function SpaceManBLaser(px, py, pframe, pdir, pid)
  15.    {
  16.       this.x = px;
  17.       this.y = py;
  18.       this.id = pid;
  19.       this.dir = pdir;
  20.       this.frame = pframe;
  21.       _root.d = _root.d + 1;
  22.       this.clip = _root.attachMovie("spaceManBLaser","spaceManBLaser" + this.id + "Clip",_root.d);
  23.       this.clip._x = this.x;
  24.       this.clip._y = this.y;
  25.       this.clip.id = this.id;
  26.       this.yMov = 0;
  27.       this.xMov = this.dir != "L" ? 22 : -22;
  28.       this.clip.gotoAndStop(this.frame / 4);
  29.       this.xMov *= _root.dif.speed;
  30.       this.yMov *= _root.dif.speed;
  31.    }
  32.    function hit()
  33.    {
  34.       this.yank = true;
  35.    }
  36.    function main()
  37.    {
  38.       this.xMov *= 1.02;
  39.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  40.       {
  41.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  42.          this.yank = true;
  43.       }
  44.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  45.       {
  46.          this.yank = true;
  47.       }
  48.       this.x += this.xMov;
  49.       if(this.yank)
  50.       {
  51.          _root.removeEnemyShot("spaceManBLaser" + this.id);
  52.          this.yank = false;
  53.       }
  54.       this.clip._x = this.x;
  55.       this.clip._y = this.y;
  56.    }
  57. }
  58.